﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.IO;

namespace ReportingManager
{
    public partial class frmSelectReport : DevExpress.XtraEditors.XtraForm
    {

        public frmSelectReport()
        {
            InitializeComponent();
            Config.Get.Path = Application.StartupPath + "\\Raporlar";
        }

        private void frmSelectReport_Load(object sender, EventArgs e)
        {
            if (Directory.Exists(Config.Get.Path))
            {
                string[] dosyalar = Directory.GetFiles(Config.Get.Path, "*.sql");
                for (int i = 0; i < dosyalar.Length; i++)
                {
                    FileInfo f = new FileInfo(dosyalar[i]);
                    comboBoxEdit1.Properties.Items.Add(f.Name.Replace(".sql", ""));
                }
            }
            else
            {
                MessageBox.Show("Raporlar Klasörü bulunamadı !");
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            Config.Get.RaporAdi = comboBoxEdit1.Text;
            Config.Get.CurrentReportFile = Config.Get.Path + "\\" + comboBoxEdit1.Text + ".sql";
            frmRaporFiltre frm = new frmRaporFiltre();
            frm.Show();
        }
    }
}